package cn.snowheart.strategy.spring.context;

import cn.snowheart.strategy.spring.enums.OrderType;
import cn.snowheart.strategy.spring.handler.IOrderHandler;

import java.util.Map;

/**
 * @author liuwanxiang
 * @version 2019/06/24
 */
public class HandlerContext {

    private Map<OrderType, IOrderHandler> map;

    HandlerContext(Map<OrderType, IOrderHandler> map) {
        this.map = map;
    }

    public IOrderHandler getOrderHandler(OrderType type) {
        if (type == null) {
            throw new IllegalArgumentException("type must not be null~");
        }
        return map.get(type);
    }

}
